using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using trainstorm.BaseClass;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;

namespace trainstorm.InstanceClass
{
	public class SplashScreen : BaseScreen
	{
		private Color tint;
		private float color;
		private bool isDarkening;
		private bool second;
		public SplashScreen()
		{
			color = 0; tint = new Color(); isDarkening = false; second = false;
		}
		public SplashScreen(Game1 game, Texture2D splash1, Texture2D splash2)
			: base(game)
		{
			layers = new Texture2D[] { splash1, splash2 };
			Vector2 satu = new Vector2((Game1.screenWidth - splash1.Width) / 2, (Game1.screenHeight - splash1.Height) / 2);
			Vector2 dua = new Vector2((Game1.screenWidth - splash2.Width) / 2, (Game1.screenHeight - splash2.Height) / 2);
			layerPos = new Vector2[] { satu, dua };
			layerVel = new Vector2[layers.Length];
			color = 0f; tint = new Color(); isDarkening = false; second = false;
		}
		public override void Update(Game1 game, Microsoft.Xna.Framework.GameTime gameTime)
		{
			//base.Update(game, gameTime);
			//if (color >= 255)
			//    isDarkening = true;

			//color += (float)gameTime.ElapsedGameTime.TotalSeconds * 60f * (isDarkening ? -1 : 1);
			//tint = new Color(255, 255, 255, color / 255f);

			//if (game.getGesture().GestureType != GestureType.None)
			//    color = -1;
			//if (color < 0)
			//{
			//    if (!second)
			//    {
			//        isDarkening = false;
			//        second = true;
			//        color = 0;
			//    }
			//    else
			//    {
			        game.setScreen(new GameScreen(game));
			//    }
			//}
		}
		public override void Draw(SpriteBatch batch) 
		{
			int num = second ? 1 : 0;
			batch.Draw(layers[num], layerPos[num], tint);
		}
	}
}
